<template>
  <div class="vs-trend-by-map">
    <VsModuleTitle name="趋势图">
      <div class="vs-trend-by-map__legend">
        <div class="legend-item" v-for="(item, index) in legends" :key="index">
          <span
            class="legend-item__bar"
            :style="{ backgroundColor: item.color }"
          ></span>
          <label>{{ item.label }}</label>
        </div>
      </div>
    </VsModuleTitle>
    <div class="vs-trend-by-map__content">
      <ECharts :options="option" class="trend-charts" autoresize />
    </div>
  </div>
</template>

<script>
import VsModuleTitle from "../ModuleTitle/index";
import ECharts from "vue-echarts";
import "echarts/lib/chart/line";
import "echarts/lib/chart/pie";
import "echarts/lib/chart/bar";
import "echarts/lib/component/tooltip";
import "echarts/lib/component/legend";
import "echarts/lib/component/toolbox";
import { getTrendByMapOptions } from "./scripts";

export default {
  name: "VsTrendByMap",
  components: { VsModuleTitle, ECharts },
  filters: {},
  props: {},
  data() {
    return {
      legends: [
        { label: "批准户数", color: "#C4E14E" },
        { label: "批准宅基地面积", color: "#7CE6FD" }
      ],
      option: null
    };
  },
  computed: {},
  watch: {},
  created() {
    this.option = getTrendByMapOptions();
  },
  mounted() {},
  updated() {},
  activated() {},
  deactivated() {},
  beforeDestroy() {},
  methods: {}
};
</script>

<style lang="less">
.vs-trend-by-map {
  height: 255px;
  width: 100%;
  box-sizing: border-box;
  &__legend {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: PingFangSC-Regular !important;
    .legend-item {
      display: flex;
      align-items: center;
      margin-left: 12px;
      font-size: 16px;
      color: #ffffff;
      &__bar {
        width: 15px;
        height: 15px;
        display: inline-block;
        margin-right: 3px;
      }
    }
  }
  &__content {
    width: 100%;
    background-color: rgba(12, 26, 58, 0.7);
    .trend-charts {
      width: 100%;
      height: 220px;
    }
    box-sizing: border-box;
  }
}
</style>
